package org.jeecg.modules.demo.mes.mapper;

import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.mes.entity.CamelliaMesOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.demo.mes.entity.OrderDot;
import org.simpleframework.xml.Order;

import java.util.List;

/**
 * @Description: 订单表
 * @Author: jeecg-boot
 * @Date:   2022-12-01
 * @Version: V1.0
 */
public interface CamelliaMesOrderMapper extends BaseMapper<CamelliaMesOrder> {
    @Select("SELECT \n\tbook_user as 'name', \n\tSUM(order_num) as 'value'\nFROM camellia_mes_order\nGROUP BY book_user\nORDER BY value DESC\nLIMIT 0, 5")
    List<OrderDot> clientSource();

    @Select("SELECT \n\tp.`name`, \n\tsum(o.ORDER_NUM) as 'value'\nfrom camellia_mes_order as o\n\tLEFT JOIN camellia_mes_product as p\n\tON o.required_product = p.ID\nGROUP BY o.required_product\nORDER BY value DESC\nLIMIT 0, 5")
    List<OrderDot> salesProduct();


}

